<!DOCTYPE html>
<html>

    <!--头文件-->
    {include file='head'}

    <!--bootstrap分页-->
    <link rel="stylesheet" type="text/css" href="{$staticAdmin}dist/css/bootstrap.min.css">

<section class="rt_wrap content mCustomScrollbar">
 <div class="rt_content">
      <div class="page_title">
       <h2 class="fl">订单列表</h2>
       <a class="fr top_rt_btn add_icon">添加订单</a>
      </div>
      <section class="mtb">
       <select class="select" id="sel0">
        <option value="0">订单状态</option>
        <option value="1">待付款</option>
        <option value="2">待发货</option>
        <option value="3">待评价</option>
       </select>
       <input type="text" class="textbox textbox_225" placeholder="输入订单编号" maxlength="30"/>
       <input type="button" value="查询" class="group_btn"/>
      </section>
      <table class="table">
       <tr>
        <th class="center">订单编号</th>
        <th class="center">收件人</th>
        <th class="center">联系电话</th>
        <th class="center">收件人地址</th>
        <th class="center">订单金额</th>
        <th class="center">配送方式</th>
        <th class="center">操作</th>
       </tr>

       {foreach $order as $ord}
       <tr>
        <td class="center">{$ord['order_card']}</td>

        {foreach $receive as $rece}
             {if $rece['receive_id'] == $ord['receive_id']}
        <td class="center">{$rece['receive_name']}</td>
        <td class="center">{$rece['receive_phone']}</td>
        <td class="center">
         <address>{$rece['all_place']}{$rece['detail_address']}</address>
        </td>
            {/if}
        {/foreach}
        <td class="center"><strong class="rmb_icon">{$ord['last_paid']}</strong></td>
        {foreach $send as $se}
            {if $se['send_id'] == $ord['send_id']}
        <td class="center">{$se['send_name']}</td>
            {/if}
        {/foreach}
        <td class="center">
         <a href="detail?oid={$ord['order_id']}" title="查看订单" class="link_icon" name="finder">&#118;</a>
         <a title="删除" class="link_icon" name="receive" receiver="{$ord['order_id']}">&#100;</a>
        </td>
       </tr>
      {/foreach}

      </table>
      <aside class="paging">
          {$orderPage}
      </aside>
 </div>
</section>
</body>
</html>
<script>

     //回收
      $(function () {

          //点击事件
          $('[name=receive]').click(function () {

              //取值
              var $ordId = $(this).attr('receiver');
              console.log($ordId);

              var $rece = 1;

              $.post('flag',{ordId:$ordId,receive:$rece},success,'json');

          });


          //回调函数
          function success(data)
          {
              console.log(data);

              switch (data.state) {

                  case 1:
                      alert(data.tip);
                      //重载当前页面
                      window.location.reload();
                      break;

                  case 2:
                      alert(data.tip);
                      break;


              }
          }
      });

</script>
